Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

219
Vistas
What is the difference between an array like [ ] and (12) {...}, {...}, {...}, etc

Okay, I have searched far and wide. I can't figure out why my array.push gives me [] and not (#) {...}, {...}, {...}, etc. Here is my relevant code:

let newArray = [];

const fetchAll = async (urls) => {
    const res = await Promise.all(urls.map(u => fetch(u)))
    const jsons = await Promise.all(res.map(r => r.json()))

    for (let i = 0; i < jsons.length; i++) {
        for (let j = 0; j < 2; j++) {
            newArray.push({
                'img': jsons[i].hits[j].previewURL
            });
        }
    }
}

Like I said, I specifically want the array to output like (#) {...}, {...}, {...} etc. Right now I'm just getting [ ]. With the array.

For reference: I want my array to look like the bottom console.log. The top is what I'm getting.Screenshot of console.log

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda